
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
Working with PowerBuilder synchronization objects</TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="apptechp75.htm">Previous</A>&nbsp;&nbsp;<A HREF="apptechp77.htm" >Next</A>
<!-- End Header -->
<A NAME="BCGEFGHC"></A><h1>Working with PowerBuilder synchronization objects</h1>
<A NAME="TI1893"></A><p>When you run the ASA MobiLink Synchronization wizard from
the Database page in the New dialog box, the wizard generates objects
that let you initiate and control MobiLink synchronization requests
from a PowerBuilder application. These objects let you obtain feedback
during the synchronization process, code PowerScript events at specific
points during synchronization, and cancel the process programmatically.</p>
<A NAME="TI1894"></A><p>For more information about the MobiLink synchronization wizard,
see "Managing the Database" in the <i>Users
Guide</i>
.</p>
<A NAME="TI1895"></A><h2>Preparing to use the wizard</h2>
<A NAME="TI1896"></A><p>Before you use the wizard in a production application, you
need to complete the following tasks:<A NAME="TI1897"></A>
<ul>
<li class=fi>Set up
a consolidated database and write synchronization scripts as described
in <A HREF="apptechp77.htm#BCGHDGGA">"Preparing consolidated databases"</A></li>
<li class=ds>Create a remote database on the desktop and set
up one or more publications, users, and subscriptions as described
in <A HREF="apptechp78.htm#BCGJBBCH">"Creating remote databases"</A></li>
<li class=ds>Register the database with the ODBC manager on all
remote machines, or create a file DSN for the remote database, as
described in <i>Connecting to Your Database</i>
 in
the PowerBuilder online Help and in <A HREF="apptechp76.htm#BABBJAHJ">"Using a file DSN instead
of a registry DSN"</A></li>
<li class=ds>Make sure all remote machines have the required
supporting files, as described in <A HREF="apptechp76.htm#BABDHHJC">"Runtime requirements for synchronization on remote machines"</A></li>
<li class=ds>(Optional) Create a database connection profile
for the remote database, as described in <i>Connecting to
Your Database</i>
 in the PowerBuilder online Help. This allows
the wizard to retrieve a list of publications in the remote database
for which MobiLink subscriptions have been entered
</li>
</ul>
</p>
<A NAME="TI1898"></A><h2>What gets generated</h2>
<A NAME="TI1899"></A><p>The wizard generates two sets of objects. </p>
<A NAME="TI1900"></A><h4>Objects that initiate and monitor synchronization</h4>
<A NAME="TI1901"></A><p>The first set of objects lets the end user initiate and monitor
synchronization:<A NAME="TI1902"></A>
<ul>
<li class=fi><b>nvo_</b><i>appname_mlsync</i> &#8211; a
custom class user object that controls the MobiLink client (<i>appname</i> is
the name of your application)</li>
<li class=ds><b>gf_</b><i>appname_sync</i> &#8211; a
global function that instantiates the user object and calls a function
to launch a synchronization request</li>
<li class=ds><b>w_</b><i>appname_syncprogress</i> &#8211; an
optional status window that reports the progress of the synchronization
process
</li>
</ul>
</p>
<A NAME="TI1903"></A><p>In the wizard, you can choose whether the application uses
the status window. The generated status window includes an OK button
that lets the user view the status before dismissing the window,
and a Cancel button that lets the user cancel synchronization before
it completes. You can also customize the window to fit your application's
needs.</p>
<A NAME="TI1904"></A><h4>Objects that modify synchronization options</h4>
<A NAME="TI1905"></A><p>The second set of objects is generated only if you select
Prompt User for Password and Runtime Changes in the wizard. It lets
the end user change synchronization options before initiating synchronization:<A NAME="TI1906"></A>
<ul>
<li class=fi><b>w_</b><i>appname</i><b>_sync_options</b> &#8211; an
options window that lets the end user modify the MobiLink user name
and password, the host name and port of the MobiLink server, and
other options for <b>dbmlsync</b>, and choose how to display
status</li>
<li class=ds><b>gf_</b><i>appname</i><b>_configure_sync</b> &#8211; a
global function that opens the options window and, if the user clicked
OK, calls <b>gf_</b><i>appname_sync</i> to
initiate synchronization
</li>
</ul>
</p>
<A NAME="TI1907"></A><p>Most applications that use the options window provide two
menu items or command buttons to launch synchronization: one to
open the options window so that users can set up or modify <b>dbmlsync</b> options
before requesting a synchronization, and one to request a synchronization
with the preset options.</p>
<A NAME="TI1908"></A><h2>Creating an instance of MLSync </h2>
<A NAME="TI1909"></A><p>You do not have to use the MobiLink Synchronization Wizard
to create a nonvisual object that launches <b>Dbmlsync.exe</b>.
You can include an MLSync system object in your applications:<A NAME="TI1910"></A>
<ul>
<li class=fi>Programmatically with PowerScript</li>
<li class=ds>By selecting it from the New dialog box
</li>
</ul>
</p>
<A NAME="TI1911"></A><h4>Adding an MLSync object programatically</h4>
<A NAME="TI1912"></A><p>The code fragment below creates an instance of an MLSync object
and programmatically populates all of the necessary properties&#8212;as
well as some optional properties&#8212;using an instance of the
system SyncParm structure.  Then it calls the Synchronize function
to start the database synchronization.<p><PRE> SyncParm            Parms</PRE><PRE> MLSync            mySync</PRE><PRE> Long            rc</PRE><PRE> </PRE><PRE> mySync = CREATE MLSync</PRE><PRE> mySync.MLServerVersion = 11        // required property</PRE><PRE> mySync.Publication = 'salesapi    '// required property</PRE><PRE> mySync.UseLogFile = TRUE        // optional</PRE><PRE> mySync.LogFileName = "C:\temp\sync.log    "// optional</PRE><PRE> mySync.Datasource = 'salesdb_remote    '// required</PRE><PRE> Parms.MLUser = '50            '// required</PRE><PRE> Parms.MLPass = 'xyz123            '// required</PRE></p>
<A NAME="TI1913"></A><p><p><PRE> //The following values are required if they are not </PRE><PRE> //set by the DSN</PRE><PRE> Parms.DBUser = 'dba        '</PRE><PRE> Parms.DBPass = 'sql        '</PRE><PRE> </PRE><PRE> //  Apply the property values to the sync object</PRE><PRE> mySync.SetParm(Parms)    </PRE><PRE> //  Launch the synchronization process</PRE><PRE> rc = mySync.Synchronize()    </PRE><PRE> destroy mySync</PRE></p>
<A NAME="TI1914"></A><h4>Adding an MLSync object from the New dialog box</h4>
<A NAME="TI1915"></A><p>You can add an MLSync object to a target PBL using the New
dialog box: from the PowerBuilder menu, choose File&gt;New,
go to the PB Object tab, select Standard Class, then MLSync. This
opens a new MLSync object in the User Object painter, where you
can initialize all or some of the properties. When you are finished,
you can save it as a new object in your target PBL.  </p>
<A NAME="TI1916"></A><p>Since all of the properties are already initialized, including
userids and passwords, it is ready for immediate use. To launch
a synchronization requires very little coding, as this example for
an MLsync object that you save as "nvo_my_mlsync" illustrates:<p><PRE> nvo_my_mlsync         mySync</PRE><PRE> Long        rc</PRE><PRE> mySync = CREATE nvo_my_mlsync</PRE><PRE> mySync.Synchronize()</PRE><PRE> destroy mySync</PRE></p>
<A NAME="TI1917"></A><p>You would typically add the above code to the Clicked event
for a menu item or a command button on one of the application windows.</p>
<A NAME="TI1918"></A><h4>For more information</h4>
<A NAME="TI1919"></A><p>For more information on system objects related to synchronization,
and their functions, events, and properties, see MLSynchronization,
MLSync, and SyncParm in the online Help.</p>
<A NAME="TI1920"></A><h2>Auxiliary objects for MobiLink synchronization</h2>
<A NAME="TI1921"></A><p>If you create an instance of MLSync by PowerScript code or
from the New dialog box, you should also consider using auxiliary
objects that are generated automatically by the wizard that you
can customize in the PowerBuilder Window painter. </p>
<A NAME="TI1922"></A><h4>Using an existing synchronization progress window</h4>
<A NAME="TI1923"></A><p>After you instantiate an MLSync object and call <b>SetParm</b> to
enable an end user to set authentication properties at runtime,
you can call a Response! type window to document the progress of
a database synchronization. You open the progress window with an <b>OpenWithParm</b> call,
using the window name and the MLSync object name as arguments. By
default, the wizard generates a progress window named w_<i>appname</i>_syncprogress
and adds the <b>OpenWithParm</b> call for you.</p>
<A NAME="TI1924"></A><p>In the Properties view for an MLSync object, you can select
a customized progress window to document the progress of a synchronization
call. If you customize a wizard-generated progress window&#8212;typically
to hide some of the fields on its tab pages, or even to hide one
or two of the tab pages&#8212;you can select the customized progress
window for all of your MobiLink applications.</p>
<A NAME="TI1925"></A><h4>Changing the connection arguments at runtime</h4>
<A NAME="TI1926"></A><p>To allow a user to override authentication parameters at runtime,
you can call a customized options window or the synchronization
options window generated by the wizard. The options window can,
in turn, call an instance of the SyncParm object that can be initialized
with authentication values from a highly secure persistent store,
such as a remote database table. You can choose to make some or
all of the authentication values writeable, allowing the end user
to override them at runtime.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Maintaining property settings in the MLSync object</span> <A NAME="TI1927"></A>Normally when you call <b>SetParm</b>(SyncParm)
from an MLSync object, you automatically override any authentication
values (AuthenticationParms, DBUser, DBPass, EncryptionKey, MLUser,
and MLPass) that you set for properties of the MLSync object&#8212;even
when the value of a particular SyncParm property is an empty string.
However, if you call <b>SetNull</b> to set a particular
property of the SyncParm object to NULL before you call <b>SetParm</b>, the
property value in the MLSync object will be used instead. </p>
<A NAME="TI1928"></A><p>The default synchronization options window, w_<i>appname</i>_sync_options, returns
a SyncParm structure to its caller through the PowerObjectParm property
of the Message object. This allows the caller to save the highly sensitive
authentication property values in a secure location. It also sets
the SyncParm ReturnCode property with an integer value that indicates
whether to proceed with the actual synchronization.</p>
<A NAME="BABBHGCI"></A><h4>Default tab pages of the
options window</h4>
<A NAME="TI1929"></A><p>The default synchronization options window has four tab pages: Subscriptions, <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere, MobiLink Server, and
Settings. </p>
<p><b>Subscriptions page</b>   When you used the MobiLink wizard, you selected one or more
publications from the list of available publications. The selected publications
display on the Subscriptions page, but cannot be edited at runtime. </p>
<A NAME="TI1930"></A><p>Each remote user can supply a MobiLink synchronization user
name on this page. The name must be associated in a subscription
with the publications displayed on the page. If the application
is always used by the same MobiLink user, this information never
needs to be supplied again. The name is saved in the registry and
used by default every time synchronization is launched from the
application on this device. </p>
<A NAME="TI1931"></A><p>The MobiLink password and authentication parameters are never
saved to the user's registry. They can either be entered
each time by the user or provided from a secure database.</p>
<p><b><ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
page</b>   Remote users can supply a DSN file name on this page to pass
all the arguments needed to connect to a remote database.</p>
<A NAME="TI1932"></A><p>If a DSN file is not used, or if the DSN file does not include
a user name and password, each remote user can supply a remote database
user name. The name is saved in the registry and used by default
every time synchronization is launched from the application on this
device. </p>
<A NAME="TI1933"></A><p><A HREF="apptechp76.htm#BABHAGBE">Figure 13-3</A> displays
the options window <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
tab page with DSN, DBUser, DBPass, and Encryption Key fields. The
database password and encryption key are never saved in the registry.</p>
<A NAME="BABHAGBE"></A><caption><b>Figure 13-3: Synchronization options window</b></captionls>
<br><img src="images/syncopts.gif">
<p><b>MobiLink Server page</b>   When you create a subscription, you specify a protocol, host,
port, and other connection options. For ease of testing, the default
protocol is TCP/IP and the default host is localhost. The
default port is 2439 for TCP/IP, 80 for HTTP, and 443 for
HTTPS. </p>
<A NAME="TI1934"></A><p>You might need to change these defaults when you are testing,
and your users might need to change them when your application is
in use if the server is moved to another host or the port changes.
If you did not enter values for the host and port at design time,
and the user does not make any changes on this page, <b>dbmlsync</b> uses
the values in the subscription. </p>
<A NAME="TI1935"></A><p>For more information about subscriptions, see <A HREF="apptechp78.htm#BCGFJDFF">"Adding subscriptions"</A>.</p>
<p><b>Settings page</b>   The Settings page displays logging options, and any other <b>dbmlsync</b> options
you specified at design time and lets the user change any of these
options at runtime. It also gives the user a choice of displaying
or not displaying a synchronization progress window.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Extended options</span> <A NAME="TI1936"></A>Extended options are added to the <b>dbmlsync</b> command
line with the <b>-e</b> switch. You do not need to type
the <b>-e</b> switch in the text box.</p>
<A NAME="TI1937"></A><h2>Using the synchronization objects in your application</h2>
<A NAME="TI1938"></A><p>Before you use the generated objects, you should examine them
in the PowerBuilder painters to understand how they interact. Many
of the function and event scripts contain comments that describe
their purpose. </p>
<A NAME="TI1939"></A><p>All the source code is provided so that you have total control
over how your application manages synchronization. You can use the
objects as they are, modify them, or use them as templates for your
own objects.</p>
<A NAME="TI1940"></A><h4>Properties of the user object</h4>
<A NAME="TI1941"></A><p>The <b>nvo_</b><i>appname_mlsync</i> user
object contains properties that represent specific <b>dbmlsync</b> arguments,
including the publication name, the MobiLink server host name and
port, and the user name and password for a connection to the remote
database.</p>
<A NAME="TI1942"></A><p>When you run the wizard, the values that you specify for these
properties are set as default values in the script for the constructor
event of the user object. They are also set in the Windows registry
on the development computer in <i>HKEY_CURRENT_USER\Software\Sybase\PowerBuilder\11.5\appname<br>\MobiLink</i>,
where <i>appname</i> is the name of your application. </p>
<A NAME="TI1943"></A><p>At runtime, the constructor event script gets the values of
the properties from the registry on the remote machine. If they
cannot be obtained from the registry, or if you override the registry
settings, the default value supplied in the script is used instead
and is written to the registry. </p>
<A NAME="TI1944"></A><p>You can change the default values in the event script, and
you can let the user change the registry values at runtime by providing
a menu item that opens the <b>w_</b><i>appname</i><b>_sync_options</b> window. </p>
<A NAME="TI1945"></A><h4>Launching dbmlsync</h4>
<A NAME="TI1946"></A><p>To enable the user to launch a synchronization process, code
a button or menu event script to call the <b>gf_</b><i>appname_sync</i> global
function. This function creates an instance of the <b>nvo_</b><i>appname_mlsync</i> user
object, and the user object's constructor event script
sets the <i>appname\MobiLink</i> key in the
registry of the remote machine.</p>
<A NAME="TI1947"></A><p>If you specified in the wizard that the progress window should
display, the global function opens the progress window, whose <b>ue_postopen</b> event
calls the <b>nvo_</b><i>appname_mlsync</i> user
object's synchronize function; otherwise, the global function
calls the <b>synchronize</b> function. The synchronize
function launches <b>dbmlsync</b> as an external process.</p>
<A NAME="TI1948"></A><h4>Supplying a MobiLink user name and password</h4>
<A NAME="TI1949"></A><p>The global function takes a structure for its only argument.
You can pass a system SyncParm structure that you instantiate. The
structure includes six variables with string datatypes (one each
for MobiLink and remote database user names and passwords, as well
as variables for the authentication parameters and the encryption
key) and another variable that takes a long datatype for a return
code. </p>
<A NAME="TI1950"></A><p>If you assign valid values to the structure that you pass
as an argument, the global function passes these values to the user
object to enable MobiLink server and remote database connections. </p>
<A NAME="TI1951"></A><p>The options window (described in <A HREF="apptechp76.htm#BABBHGCI">"Default tab pages of the
options window"</A>) provides a mechanism to store
certain of these values in the registry the first time a user starts
a synchronization. (Sensitive password and encryption information
is never saved to the registry.) Subsequent synchronizations can
be started without the user having to reenter the information, however,
the options window can still be used to override and reset the registry
values. </p>
<A NAME="TI1952"></A><h4>Retrieving data after synchronization</h4>
<A NAME="TI1953"></A><p>After synchronizing, you would typically test for synchronization
errors, then retrieve data from the newly synchronized database.
For example:<p><PRE> if gf_myapp_sync(s_opt) &lt;&gt; 0 then<br>   MessageBox("Error", "MobiLink error")<br>else<br>   dw_1.Retrieve()<br>end if</PRE></p>
<A NAME="TI1954"></A><h4>Capturing dbmlsync messages</h4>
<A NAME="TI1955"></A><p>The PowerBuilder VM traps messages from the <b>dbmlsync</b> process
and triggers events in the user object as the synchronization process
runs.</p>
<A NAME="TI1956"></A><p>These events are triggered before synchronization begins as
the upload stream is prepared:<A NAME="TI1957"></A>
<ul>
<li class=fi><b>ue_begin_logscan
( long <i>rescan_log</i> )</b></li>
<li class=ds><b>ue_progress_info ( long <i>progress_index</i>,
long <i>progress_max</i> )</b></li>
<li class=ds><b>ue_end_logscan ( )</b>
</li>
</ul>
</p>
<A NAME="TI1958"></A><p>These events correspond to events on the synchronization server,
as described in <A HREF="apptechp77.htm#BCGGDJDE">"Connection events"</A>:<A NAME="TI1959"></A>
<ul>
<li class=fi><b>ue_begin_sync ( string <i>user_name</i>,
string <i>pub_names</i>)</b></li>
<li class=ds><b>ue_connect_MobiLink (
)</b></li>
<li class=ds><b>ue_begin_upload ( )</b></li>
<li class=ds><b>ue_end_upload ( )</b></li>
<li class=ds><b>ue_begin_download ( )</b></li>
<li class=ds><b>ue_end_download ( long <i>upsert_rows</i>,
long <i>delete_rows</i> )</b></li>
<li class=ds><b>ue_disconnect_MobiLink(
)</b></li>
<li class=ds><b>ue_end_sync ( long <i>status_code</i> )</b>
</li>
</ul>
</p>
<A NAME="TI1960"></A><p>These events are triggered after <b>ue_end_upload</b> and
before <b>ue_begin_download</b>:<A NAME="TI1961"></A>
<ul>
<li class=fi><b>ue_wait_for_upload_ack
( )</b></li>
<li class=ds><b>ue_upload_ack ( long <i>upload_status</i> )</b>
</li>
</ul>
</p>
<A NAME="TI1962"></A><p>These events are triggered when various messages are sent
by the server:<A NAME="TI1963"></A>
<ul>
<li class=fi><b>ue_error_msg
( string <i>error_msg</i> )</b></li>
<li class=ds><b>ue_warning_msg ( string <i>warning_msg</i> )</b></li>
<li class=ds><b>ue_file_msg ( string <i>file_msg</i> )</b></li>
<li class=ds><b>ue_display_msg ( string <i>display_msg</i> )</b>
</li>
</ul>
</p>
<A NAME="TI1964"></A><p>The default event scripts created by the wizard trigger corresponding
events in the optional progress window, if it exists. The window
events write the progress to the multiline edit control in the progress
window. Some window events also update a static text control that
displays the phase of the synchronization operation that is currently
running (log scan, upload, or download) and control a horizontal
progress bar showing what percentage of the operation has completed.</p>
<A NAME="TI1965"></A><p>You can also add code to the user object or window events
that will execute at the point in the synchronization process when
the corresponding MobiLink events are triggered. The <b>dbmlsync</b> process
sends the event messages to the controlling PowerBuilder application
and waits until PowerBuilder event processing is completed before
continuing.</p>
<A NAME="TI1966"></A><h4>Cancelling synchronization</h4>
<A NAME="TI1967"></A><p>The Cancel button on the progress window calls the <b>cancelsync</b> user
object function to cancel the synchronization process. If your application
does not use the progress window, you can call this function in
an event script elsewhere in your application.</p>
<A NAME="BABDHHJC"></A><h2>Runtime requirements for synchronization on remote machines</h2>
<A NAME="TI1968"></A><h4>Support files required on remote machine</h4>
<A NAME="TI1969"></A><p>If you do not install PowerBuilder or <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
on remote machines, you must copy the files listed in <A HREF="apptechp76.htm#BABDFGDA">Table 13-1</A> to use MobiLink
synchronization with a PowerBuilder application. These files must
be copied to the system path on the remote machine or the directory
where you copy your PowerBuilder applications. </p>
<A NAME="BABDFGDA"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 13-1: Required runtime files on system
path of remote machine</caption>
<tr><th  rowspan="1"  ><A NAME="TI1970"></A>Required files</th>
<th  rowspan="1"  ><A NAME="TI1971"></A>Description</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1972"></A><i>PBDPL115.DLL</i>, <i>PBVM115.DLL</i>, <i>PBDWE115.DLL</i>, <i>PBSHR115.DLL</i>, <i>PBODB115.DLL</i>, <i>PBODB115.INI</i>, <i>LIBJCC.DLL</i>, <i>LIBJUTILS.DLL</i></td>
<td  rowspan="1"  ><A NAME="TI1973"></A>PowerBuilder files that you can copy
from the <i>Shared\PowerBuilder</i> directory
of the development machine.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1974"></A><i>GDIPLUS.DLL</i>, <i>MSVCP71.DLL</i>, <i>MSVCR71.DLL</i></td>
<td  rowspan="1"  ><A NAME="TI1975"></A>Microsoft files that ship with PowerBuilder. For
restrictions on distributing these files with client applications,
see <A HREF="apptechp246.htm#BABCJHBA">"Microsoft files"</A>. </td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1976"></A><i>DBENG11.EXE</i>, <i>DBMLSYNC.EXE</i>, <i>DBSERV11.DLL</i>, <i>DBTOOL11.DLL</i>, <i>DBODBC11.DLL</i>, <i>DBLIB11.DLL</i>, <i>DBLGEN11.DLL</i>, <i>DBCON11.DLL</i>, <i>DBCTRS11.DLL</i>, <i>DBICU11.DLL</i>, <i>DBICUDT11.DLL</i></td>
<td  rowspan="1"  ><A NAME="TI1977"></A><ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
and MobiLink files that you can copy from the <i>Sybase\SQL Anywhere 11\bin32</i> (or <i>bins64</i>)
directory of the development machine. You should copy these files
to a "bin32" subdirectory of the location where
you copy the PowerBuilder application and supporting runtime files.</td>
</tr>
</table>
<A NAME="TI1978"></A><h4>Registry requirements for a remote machine</h4>
<A NAME="TI1979"></A><p>If you install <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
on all remote machines that you use with MobiLink synchronization,
the required registry entries are assigned automatically. If you
copy <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere and MobiLink
files to a remote machine, you must create the <i>HKEY_CURRENT_USER\SOFTWARE\Sybase\SQL
Anywhere\11.0</i> registry key and add a "Location" string
value that points to the parent directory of the <i>bin32</i> or <i>bin64</i> subdirectory
where you copied <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
and MobiLink files. (The code in the <b>uf_runsync</b> function
of the <b>nvo_</b><i>appname_sync</i> user object
appends "<i>\bin32\dbmlsync.exe</i>" to
the path that you assign to this registry value.)</p>
<A NAME="TI1980"></A><p>Objects generated by the MobiLink Synchronization wizard also
require registry entries to define the ODBC data source for a remote <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere connection. <A HREF="apptechp76.htm#BABCDDGB">Table 13-2</A> lists the required
registry entries. You can create a REG file that installs these
registry entries. </p>
<A NAME="BABCDDGB"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 13-2: Required registry entries on
remote machine</caption>
<tr><th  rowspan="1"  ><A NAME="TI1981"></A>Registry key</th>
<th  rowspan="1"  ><A NAME="TI1982"></A>Name of string value and data to assign
it</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1983"></A><i>HKEY_LOCAL_MACHINE\SOFTWARE\<br>ODBC\ODBCINST.INI\SQL
Anywhere 11.0</i></td>
<td  rowspan="1"  ><A NAME="TI1984"></A>Driver = full path to <i>DBODBC11.DLL</i> <br>Setup = full
path to <i>DBODBC11.DLL</i></td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1985"></A><i>HKEY_LOCAL_MACHINE\SOFTWARE\<br>ODBC\ODBCINST.INI\ODBC
Drivers</i></td>
<td  rowspan="1"  ><A NAME="TI1986"></A><ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere
11.0 = "Installed"</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1987"></A><i>HKEY_LOCAL_MACHINE\SOFTWARE\<br>ODBC\ODBC.INI\ODBC
Data Sources</i></td>
<td  rowspan="1"  ><A NAME="TI1988"></A><i>dataSourceName</i> = "<ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere 11.0"</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI1989"></A><i>HKEY_LOCAL_MACHINE\SOFTWARE\<br>ODBC\ODBC.INI</i>\<i>dataSourceName</i></td>
<td  rowspan="1"  ><A NAME="TI1990"></A>Driver = full path to <i>DBODBC11.DLL</i> Userid = user name
for remote database Password = password for remote database<br>DatabaseName = <i>remoteDatabaseName</i> DatabaseFile = full
path to remote database <br>ServerName = <i>remoteDatabaseName</i> Start = "dbeng11
-c 8M" <br>CommLinks = "shmem"</td>
</tr>
</table>
<A NAME="BABBJAHJ"></A><h4>Using a file DSN instead
of a registry DSN</h4>
<A NAME="TI1991"></A><p>You can use a file DSN or a registry DSN for your remote database connections.
 To avoid having to specify a fully qualified path, you can copy file
DSNs to a path specified by the ODBC registry key (typically <i>c:\program files\common
files\ODBC\data sources</i>). </p>
<A NAME="TI1992"></A><p>The following is an example of the contents of a valid file
DSN:<p><PRE> [ODBC]<br>DRIVER=SQL Anywhere 11.0<br>UID=dba<br>Compress=NO<br>AutoStop=YES<br>Start=dbeng11 -c 8M -zl -ti 0<br>EngineName=SalesDB_Remote<br>DBN=SalesDB_Remote<br>DatabaseFile=C:\work\salesdb\salesdb_remote.db<br>DatabaseName=SalesDB_remote</PRE></p>
<A NAME="TI1993"></A><p>The Datasource property of the MLSync object distinguishes
a file DSN from a registry DSN using these rules:<A NAME="TI1994"></A>
<ul>
<li class=fi>If the Datasource name ends with a <i>.dsn</i> file
extension, it is a file DSN</li>
<li class=ds>If the Datasource name begins with "<FONT FACE="Courier New"><i>drive</i>:\</FONT>" prefix
where <i>drive</i> is any alphabetic character, then
it is a file DSN
</li>
</ul>
</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>File DSN location before EBFs are applied to older
DBMS versions</span> <A NAME="TI1995"></A>If you have not applied the latest EBFs to <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere 10.0.0 or Adaptive Server
Anywhere 9, <b>dbmlsync</b> looks in the current directory
for file DSNs when a full path is not specified&#8212;not in
the path specified by the ODBC registry key. The registry key is
used by <ACRONYM title = "sequel" >SQL</ACRONYM> Anywhere 10.0.1
and later to locate file DSNs when their paths are not fully qualified.</p>

